﻿using GemBox.Spreadsheet;
using GemBox.Spreadsheet.WinFormsUtilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Battleship
{
    public partial class DataGVMaximize : Form
    {
        string mPath="";
        public DataGVMaximize()
        {
            InitializeComponent();
        }
        public DataGVMaximize(string path)
        {
            InitializeComponent();
            mPath = path;
        }
        private void DataGVMaximize_Load(object sender, EventArgs e)
        {
            var workbook = ExcelFile.Load(mPath);
            // Export active worksheet to DataGridView.
            DataGridViewConverter.ExportToDataGridView(
                workbook.Worksheets.ActiveWorksheet,
                dataGridView,
                new ExportToDataGridViewOptions() { ColumnHeaders = true });

            // Import DataGridView back to active worksheet.
            DataGridViewConverter.ImportFromDataGridView(
                workbook.Worksheets.ActiveWorksheet,
                dataGridView,
                new ImportFromDataGridViewOptions() { ColumnHeaders = true });
        }
    }
}
